<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<link rel="stylesheet" type="text/css" href="<s:url value='/CSS/back/product/product_edit.css'/>"/>
<s:form action="productAction_update" namespace="/back/product" enctype="multipart/form-data" method="post" onsubmit="return saveOrUpdateProduct(this.form);">
  <s:hidden name="product.productId"/>
  <div class="product-title">Edit Product</div>
  <div class="product-edit">
    <div class="product-edit-left">
      <div class="group">
        <s:fielderror cssClass="error"></s:fielderror> 
        <div class="label">Name:</div>
        <div class="field"><s:textfield cssClass="text" id="name" name="product.name"></s:textfield></div>
      </div>
      <div class="group">
        <div class="label">Type:</div>
        <div class="field"><s:select cssClass="select" name="product.productType.typeId" list="map"></s:select></div>
      </div>
      <div class="group">
        <div class="label">Base Price:</div>
        <div class="field"><s:textfield cssClass="text" id="basePrice" name="product.basePrice"></s:textfield></div>
      </div>
      <div class="group">
        <div class="label">Market Price:</div>
        <div class="field"><s:textfield cssClass="text" id="marketPrice" name="product.marketPrice"></s:textfield></div>
      </div>
      <div class="group">
        <div class="label">Sales Price:</div>
        <div class="field"><s:textfield cssClass="text" id="salesPrice" name="product.salesPrice"></s:textfield></div>
      </div>
      <div class="group">
        <div class="label">IsRecommended:</div>
        <div class="field"><s:radio cssClass="radio" name="product.isRecommended" list="#{'true': 'Yes', 'false': 'No'}"></s:radio></div>
      </div>
      <div class="group">
        <div class="label">Sex Request:</div>
        <div class="field"><s:select cssClass="select" name="product.sexRequest" list="@com.aoyy.util.product.Sex@getNames()" value="product.sexRequest.getName()"></s:select></div>
      </div>
      <div class="group">
        <div class="label">Upload Picture:</div>
        <div class="field"><s:file cssClass="file" id="file" name="file" onchange="onFile(this)"></s:file></div>
      </div>
      <div class="group">
        <div class="label">CreatedTime:</div>
        <div class="field"><s:date name="product.createdTime" format="yyyy-MM-dd HH:mm:ss"></s:date></div>
      </div>
    </div>
    <div class="product-edit-right">
      <div class="show-input-picture">
        <img id="img" src="<s:property value="#request.get('javax.servlet.forward.context_path')"/>/upload/<s:property value="product.uploadFile.filePath"/>">
      </div>
    </div>
  </div>  
  <div class="product-bottom">
    <div class="group">
      <div class="label">Description:</div>
      <div class="field"><s:textarea cssClass="area" id="description" name="product.description"></s:textarea></div>
    </div>
  </div>
  <div class="product-submit">
    <s:submit cssClass="submit" value="Submit"/>
  </div>
</s:form>
<script type="text/javascript" src="<s:url value='/JS/jquery-1.7.2.min.js'/>"></script>
<script type="text/javascript" src="<s:url value='/JS/common.js'/>"></script>
<script type="text/javascript" src="<s:url value='/JS/product.js'/>"></script>
